package edu.udlap.spring2008.is300.finalexam.app.mvc.view;

import edu.udlap.spring2008.is300.finalexam.framework.mvc.view.ViewComponent;
import edu.udlap.spring2008.is300.finalexam.framework.mvc.view.ViewCompositeComponent;
import java.awt.Component;
import javax.swing.ImageIcon;
import javax.swing.JTabbedPane;

/**
 *
 * @author Ruslán Ledesma Garza
 */
public class ViewTabbedPanel extends ViewCompositeComponent
{

    JTabbedPane contentPanel_ = new JTabbedPane();
    
    public void addChild(ViewComponent child, ImageIcon imageIcon,
            String title, String tooltip)
    {
        super.addChild(child);
        
        contentPanel_.addTab(title, imageIcon, child.getComponent(), tooltip);
        contentPanel_.repaint();
    }
    
    // <editor-fold desc="overriden & implemented operations...">
    @Override
    public void addChild(ViewComponent child)
    {
        super.addChild(child);
        
        ///add the actual component to the contentPanel_...
        contentPanel_.add(child.getComponent());
        contentPanel_.repaint();
    }

    @Override
    public void removeChild(ViewComponent child)
    {
        super.removeChild(child);
        
        ///remove the actual component from the contentPanel_...
        contentPanel_.remove(child.getComponent());
        contentPanel_.repaint();
    }
    
    @Override
    public Component getComponent()
    {
        return (Component)contentPanel_;
    }
    // </editor-fold>
}
